Carbon


ThreadCurrentStackSpace

Header: Threads.h Carbon status: Supported

Determines the amount of stack space that is available for any thread in your application.

OSErr ThreadCurrentStackSpace (
    ThreadID thread, 
    UInt32 *freeStack
);
thread

The thread ID of the thread about which you want information.

freeStack

On return, a pointer to the amount of stack space (in bytes) that is available to the specified thread.

function result

A result code.

DISCUSSION

This function is primarily useful during debugging since you determine the maximum amount of stack space you need for any particular thread before you ship your application. However, if your application calls a recursive function that could call itself many times, you might want to use ThreadCurrentStackSpace to keep track of the stack space and take appropriate action if it becomes too low.

To determine the default size that the Thread Manager assigns to threads use the GetDefaultThreadStackSize function.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when ThreadsLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by ThreadsLib 1.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 3/8/2000)